<?php
/**
 * 下午茶申请单查询
 * @package  htdocs
 * @subpackage  quanliadmin
 * @author   allen.qiang  <allen.qiang@fistforward.com> 2015-01-14 allen.qiang FUN-AC-0028-下午茶项目
 */

quanli_require('module/base/bill/billSearch.class.php');

class pa_stockSearch {

    public function execute() {

        global $G_PGLOB;

        if (isset($_REQUEST['operFlg']) && $_REQUEST['operFlg'] > 0) {

            switch ($_REQUEST['operFlg']) {

                case 1: //显示列表页面
                    $this->stockSearchList();
                    break;
                case 2: //显示修改下午茶库存页面
                    $this->modStock();
                    break;
                case 3: //显示下午茶库存商品出入库详情
                    $this->stockDetail();
                    break;
                default:
                    $G_PGLOB->smarty->assign('msg', '参数错误');
                    $G_PGLOB->smarty->display('comm/error.tpl');
            }
        }
    }

    /**
     * 显示列表页面
     */
    private function stockSearchList() {
        global $G_PGLOB;
        //当前时间
        $currentDate = date('Y-m-d');
        $G_PGLOB->smarty->assign('currentDate',$currentDate);
        $G_PGLOB->smarty->display('production/stockSearch.tpl');
    }

    /**
     * 显示修改下午茶库存页面
     */
    private function modStock() {
        global $G_PGLOB;
        quanli_require('module/base/system/sysStock.class.php');
        //实例下午茶库存类
        $sysSearch = new sysStock();
        $stock_array = $sysSearch->getStockList( $_REQUEST );
        $G_PGLOB->smarty->assign_by_ref('stock_array',$stock_array);
        $G_PGLOB->smarty->display('production/stockMod.tpl');
    }

    /**
     * 显示下午茶库存商品出入库详情
     */
    private function stockDetail() {
        global $G_PGLOB;
        quanli_require('module/base/system/sysStock.class.php');
        //实例下午茶库存类
        $sysSearch = new sysStock();
        $stock_log = $sysSearch->getStockDetail( $_REQUEST );
        $G_PGLOB->smarty->assign_by_ref('stock_log',$stock_log);
        $G_PGLOB->smarty->display('production/stockDetail.tpl');
    }

}
